//A 2-float vector type suspiciously similar to GLSL's "vec2".
//Orion Sky Lawlor, olawlor@acm.org, 2008-03-05 (Public Domain)
#pragma once

#include "OrionFlames.h"
#include "vector2d.h"

namespace OrionFlames
{
typedef Vector2f vec2;
inline vec2 normalize(const vec2 &v) { return v / (float)v.mag(); }
inline float dot(const vec2 &a, const vec2 &b) { return (float)a.dot(b); }
inline float length(const vec2 &a) { return (float)a.mag(); }
inline vec2 clamp(const vec2 &a, double lo, double hi)
{
	vec2 ret = a;

	for (int axis = 0; axis < 2; axis++)
	{
		if (ret[axis] < lo)
			ret[axis] = (float)lo;

		if (ret[axis] > hi)
			ret[axis] = (float)hi;
	}

	return ret;
}
}
